package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * ClassName: UserMapper
 * Package: com.sky.mapper
 * Description:
 *
 * @Author: 葛龙
 * @Create 2025/2/25 14:03
 * @Version 1.0
 */
@Mapper
public interface UserMapper {
    /**
     * 根据openid查用户
     * @param openId
     * @return
     */
    @Select("select * from user where openid = #{openId}")
    User getByOpenId(String openId);

    /**
     * 插入数据
     * @param user
     */
    void insert(User user);

    @Select("select * from user where id=#{id}")
    User getById(Long userId);

    /**
     * 新增用户数
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
